<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
    <span>你好</span>
    <script>
        const personArr = ['张三', '李四', '王五', '赵六', '田七']
        const random = Math.floor(Math.random() * personArr.length)
        const li = document.querySelector('li:nth-Child(2)')
        const lis = document.querySelectorAll('li');
        const span = document.querySelector('span');
        span.innerText = personArr[random]
        for (let i = 0; i < lis.length; i++) {
            lis[i].innerText = personArr[i]
        }
    </script>
</body>

</html>